#ifndef RECORD_H__
#define RECORD_H__

#include "member_type.h"
#include <stdio.h>

class Member {
public:
	Member();
	~Member();

	// name
	const char* name() const {
		return name_;
	}
	void set_name(const char* name) {
		name_ = name;
	}

	// type
	MemberType* type() const {
		return type_;
	}
	void set_type(MemberType* type) {
		type_ = type;
	}

	// next
	const Member* next() const {
		return next_;
	}
	void set_next(Member* next) {
		next_ = next;
	}

private:
	MemberType* type_;             // not owned
	const char* name_;             // not owned
	Member* next_;
};

class Record {
public:
	Record();
	~Record();

	void add(Member* member);

	// name
	const char* name() const {
		return name_;
	}
	void set_name(const char* name) {
		name_ = name;
	}

	void generate_header(FILE* f) const;

private:
	const char* name_;
	Member* members_;
	Record* next_;
};

#endif
